import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RechargeVO, RechargeForm, RechargeQuery } from '@/api/system/recharge/types';

/**
 * 查询充值码定义列表
 * @param query
 * @returns {*}
 */

export const listRecharge = (query?: RechargeQuery): AxiosPromise<RechargeVO[]> => {
  return request({
    url: '/system/recharge/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询充值码定义详细
 * @param id
 */
export const getRecharge = (id: string | number): AxiosPromise<RechargeVO> => {
  return request({
    url: '/system/recharge/' + id,
    method: 'get'
  });
};

/**
 * 新增充值码定义
 * @param data
 */
export const addRecharge = (data: RechargeForm) => {
  return request({
    url: '/system/recharge',
    method: 'post',
    data: data
  });
};

/**
 * 修改充值码定义
 * @param data
 */
export const updateRecharge = (data: RechargeForm) => {
  return request({
    url: '/system/recharge',
    method: 'put',
    data: data
  });
};

/**
 * 删除充值码定义
 * @param id
 */
export const delRecharge = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/recharge/' + id,
    method: 'delete'
  });
};
